// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_a;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Environment;
import android.os.StatFs;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

// Referenced classes of package com.nnee.p_pr.a:
//            c

public class cls_e
{

    public cls_e()
    {
    }

    public static InputStream a(String s)
    {
        return new ByteArrayInputStream(s.getBytes());
    }

    public static InputStream a(byte abyte0[])
    {
        if(abyte0 == null)
            abyte0 = "".getBytes();
        return new ByteArrayInputStream(abyte0);
    }

    public static String a(Context context)
    {
        String s = "";
        try
        {
            s = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
        }
        catch(android.content.pm.PackageManager.NameNotFoundException namenotfoundexception)
        {
            namenotfoundexception.printStackTrace();
        }
        return s;
    }

    public static String a(InputStream inputstream)
    {
        BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream));
        StringBuffer stringbuffer = new StringBuffer();
        do
        {
            String s=null;
			try {
				s = bufferedreader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            if(s != null)
            {
                stringbuffer.append(s);
                stringbuffer.append("\n");
            } else
            {
                return stringbuffer.toString();
            }
        } while(true);
    }

    public static boolean a()
    {
        boolean flag;
        if("mounted".equals(Environment.getExternalStorageState()))
            flag = true;
        else
            flag = false;
        return flag;
    }

    public static boolean a(File file, File file1)
    {
        boolean flag = false;
        if(file.exists()) {
        	FileInputStream fileinputstream;
            ZipOutputStream zipoutputstream;
            if(!file1.getParentFile().exists())
                file1.getParentFile().mkdir();
            try
            {
                fileinputstream = new FileInputStream(file);
                zipoutputstream = new ZipOutputStream(new FileOutputStream(file1));
                byte abyte0[] = new byte[1024];
                zipoutputstream.putNextEntry(new ZipEntry(file.getName()));
                do
                {
                    int j = fileinputstream.read(abyte0);
                    if(j <= 0)
                        break;
                    zipoutputstream.write(abyte0, 0, j);
                } while(true);
            }
            catch(Exception exception)
            {
                exception.printStackTrace();
                return false;
            }
            try {
				zipoutputstream.closeEntry();
				fileinputstream.close();
	            zipoutputstream.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            
            flag = true;
        }

        return flag;
    }

    public static long b()
    {
        long l;
        if(a())
        {
            StatFs statfs = new StatFs(Environment.getExternalStorageDirectory().getPath());
            l = (long)statfs.getBlockSize() * (long)statfs.getAvailableBlocks();
        } else
        {
            l = -1L;
        }
        return l;
    }

    public static String b(Context context)
    {
        String s = "";
        String s1;
        try {
			s = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
		} catch (NameNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        s1 = s.trim();
        s = s1;

        if(s != null && s.length() > 0)
        {
            int j = s.indexOf(' ');
            if(j > 0)
                s = s.substring(0, j);
        }
        return s;

    }

    public static List b(String s)
    {
        ArrayList arraylist = new ArrayList();
        if(!TextUtils.isEmpty(s))
        {
            Matcher matcher = f.matcher(s);
            while(matcher.find()) 
            {
                int j = matcher.start();
                int k = matcher.end();
                arraylist.add(new cls_c(s.substring(j, k), j, k));
            }
        }
        return arraylist;
    }

    public static byte[] b(InputStream inputstream)
    {
        ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
        byte abyte1[];
        int j=0;
        abyte1 = new byte[1024];
        try {
			j = inputstream.read(abyte1);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
while(true)
{
        int k=0;
        if(j <= 0)
            break;
        bytearrayoutputstream.write(abyte1, 0, j);
        try {
			k = inputstream.read(abyte1);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        j = k;
}
        byte abyte0[];
        System.gc();
        abyte0 = bytearrayoutputstream.toByteArray();

        return abyte0;
 
    }

    public static String c(Context context)
    {
        DisplayMetrics displaymetrics = new DisplayMetrics();
        ((WindowManager)context.getSystemService("window")).getDefaultDisplay().getMetrics(displaymetrics);
        String s = (new Integer(displaymetrics.widthPixels)).toString();
        String s1 = (new Integer(displaymetrics.heightPixels)).toString();
        return (new StringBuilder()).append(s).append("x").append(s1).toString();
    }

    public static List c(String s)
    {
        ArrayList arraylist = new ArrayList();
        if(!TextUtils.isEmpty(s))
        {
            Matcher matcher = b.matcher(s);
            while(matcher.find()) 
                arraylist.add(matcher.group());
        }
        return arraylist;
    }

    public static boolean d(String s)
    {
        return g.matcher(s).matches();
    }

    public static boolean e(String s)
    {
        return h.matcher(s).matches();
    }

    static final String a = "(?i)((http|https|ftps|sftp|3g|wap)://)?((((3g|wap|www)\\.)?([a-zA-Z0-9\\u4e00-\\u9fa5\\._-]+\\.[a-zA-Z]{2,6}))|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(:[0-9]{1,6})?(/[a-zA-Z0-9$-&(-/!:;=_\\u4e00-\\u9fa5]*)*(\\?([a-zA-Z0-9$-&(-/!:;_\\u4e00-\\u9fa5]*(=[a-zA-Z0-9$-&(-/!:;_\\u4e00-\\u9fa5]*)*)?)?";
    static Pattern b = Pattern.compile("(?i)((http|https|ftps|sftp|3g|wap)://)?((((3g|wap|www)\\.)?([a-zA-Z0-9\\u4e00-\\u9fa5\\._-]+\\.[a-zA-Z]{2,6}))|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(:[0-9]{1,6})?(/[a-zA-Z0-9$-&(-/!:;=_\\u4e00-\\u9fa5]*)*(\\?([a-zA-Z0-9$-&(-/!:;_\\u4e00-\\u9fa5]*(=[a-zA-Z0-9$-&(-/!:;_\\u4e00-\\u9fa5]*)*)?)?");
    static final String c = "<(?i)img\\s+[^>]+>";
    static final String d = "<(?i)link\\s+[^>]+>";
    static final String e = "<(?i)script\\s+[^>]+>";
    static Pattern f = Pattern.compile("(<(?i)link\\s+[^>]+>|<(?i)img\\s+[^>]+>|<(?i)script\\s+[^>]+>)");
    public static final Pattern g = Pattern.compile("[a-zA-Z0-9\\+\\.\\_\\%\\-]{1,256}\\@[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}(\\.[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25})+");
    public static final Pattern h = Pattern.compile("^\\d{11}$");
    private static final int i = 1024;

}
